package com.xs.designpattern;

import lombok.extern.slf4j.Slf4j;

/**
 * @author xs
 */
@Slf4j
public class Main {
    public static void main(String[] args) {
        // 简单的巨魔
        log.info("一个看起来很简单的巨魔接近了.");
        Troll troll = new SimpleTroll();
        troll.attack();
        troll.fleeBattle();
        log.info("简单的巨魔力量： {}.\n", troll.getAttackPower());

        // 通过添加装饰器来改变简单巨魔的行为
        log.info("拥有巨大棍棒的巨魔会让你大吃一惊.");
        Troll clubbedTroll = new ClubbedTroll(troll);
        clubbedTroll.attack();
        clubbedTroll.fleeBattle();
        log.info("棒状巨魔力量： {}.\n", clubbedTroll.getAttackPower());
    }
}